package cn.wsalix.user.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import cn.anlaser.entity.SimpleEntity;
import cn.wsalix.admin.entity.SysUser;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "MINE")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@EntityListeners({ AuditingEntityListener.class })
@Data
@EqualsAndHashCode(exclude = { "user" }, callSuper = false)
@ToString(exclude = { "user" })
public class Mine extends SimpleEntity {
	/**
	 * 1，开团商品，是否可开多个不同商品团[应对用户开团数量进行限制] 2，可参与多个商品团 3，只有已付款商品才进入当前表
	 */

	@ManyToOne(cascade = CascadeType.MERGE, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(foreignKey = @ForeignKey(name = "FK_MINE_USER"), name = "USER_ID")
	private SysUser user;

	private Long fkId;
	private int msgNum;//消息数
	private Date orderTime;
	private String orderDate;
}